#!/bin/sh

BASE=http://kansalliskirjasto.onki.fi/rest/v1
CMD=./generate-urls.py

# global
$CMD 1000 "$BASE/vocabularies?lang=fi" >onki-rest-urls-vocabularies.txt
$CMD 2000 "$BASE/search?lang=%s&query=%s" keyword >onki-rest-urls-globalSearch.txt

# vocabulary-specific
$CMD 1000 "$BASE/%s/" vocab >onki-rest-urls-vocabInfo.txt
$CMD 1000 "$BASE/%s/types" vocab >onki-rest-urls-types.txt
$CMD 1000 "$BASE/%s/topconcepts" vocab >onki-rest-urls-topConcepts.txt
$CMD 1000 "$BASE/%s/data" vocab >onki-rest-urls-vocabData.txt
$CMD 4000 "$BASE/koko/search?lang=%s&query=%s" keyword >onki-rest-urls-vocabSearch.txt
$CMD 1000 "$BASE/koko/lookup?lang=%s&label=%s" keyword >onki-rest-urls-lookup.txt

# concept-specific
$CMD 2000 "$BASE/koko/data?uri=%s" uri >onki-rest-urls-conceptdata.txt
$CMD 1000 "$BASE/koko/broader?uri=%s" uri >onki-rest-urls-broader.txt
$CMD 1000 "$BASE/koko/broaderTransitive?uri=%s" uri >onki-rest-urls-broaderTransitive.txt
$CMD 1000 "$BASE/koko/narrower?uri=%s" uri >onki-rest-urls-narrower.txt
$CMD 1000 "$BASE/koko/narrowerTransitive?uri=%s" uri >onki-rest-urls-narrowerTransitive.txt
$CMD 4000 "$BASE/koko/hierarchy?uri=%s" uri >onki-rest-urls-hierarchy.txt
$CMD 2000 "$BASE/koko/children?uri=%s" uri >onki-rest-urls-children.txt
$CMD 1000 "$BASE/koko/related?uri=%s" uri >onki-rest-urls-related.txt

# everything in one file
rm -f onki-rest-urls-all.txt
cat onki-rest-urls-*.txt >onki-rest-urls-all.txt
